package fx.iog.feed;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import fx.iog.gen.R;

public class ActivityFeedMusic extends Activity {
	private boolean telaLocalVisible = false;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_feed_music);
		
		TextView txt_titulofeed = (TextView) findViewById(R.id.txt_titulofeed);
		Typeface font = Typeface.createFromAsset(getAssets(), "fonts/lucidacaligraph.TTF");
		txt_titulofeed.setTypeface(font);
		
		this.getActionBar().setDisplayShowCustomEnabled(true);
		this.getActionBar().setDisplayShowTitleEnabled(false);

		LayoutInflater inflator = LayoutInflater.from(this);
		View v = inflator.inflate(R.layout.text_actionbar, null);
		((TextView) v.findViewById(R.id.title)).setTypeface(font);
		((TextView) v.findViewById(R.id.title))
				.setText("Configurando Feed");

		// assign the view to the actionbar
		this.getActionBar().setCustomView(v);

	}

	@SuppressLint("NewApi")
	public void mostrarTelaFeedMusic(View view) {
		FragmentFeedMusic frag_feed = new FragmentFeedMusic();

		FragmentTransaction transaction = getFragmentManager()
				.beginTransaction();

		transaction.setCustomAnimations(R.anim.fragment_animation_fade_in,
				R.anim.fragment_animation_fade_out);

		transaction.add(R.id.checkboxes_feed_music, frag_feed, "feed");

		transaction.commit();
	}
	
	public void mostrarTelaFeedLocal(View view) {
		if(!telaLocalVisible) {
			telaLocalVisible = true;
			FragmentFeedLocal fragFeedLocal = new FragmentFeedLocal();

			FragmentTransaction transaction = getFragmentManager()
					.beginTransaction();

			transaction.setCustomAnimations(R.anim.fragment_animation_fade_in,
					R.anim.fragment_animation_fade_out);

			transaction.add(R.id.checkboxes_feed_local, fragFeedLocal, "feedlocal");

			transaction.commit();
		}
	}
	
	public void marcarTodosMusica(View view) {
		FragmentFeedMusic.marcarTodos();
		
	}
	
	public void marcarTodosLocal(View view) {
		FragmentFeedLocal.marcarTodos();
		
	}
}
